<h1>Otprema robe</h1>
<p>
	<strong><?= $this->Html->link("+ Nova otpremnica", "/proizvodnja/nova_otprema") ?></strong>
	| <?= $this->Html->link('Povraćaj robe', '/proizvodnja/povracaj') ?>
</p>
<?= $this->render('filter', false) ?>
<?= $this->element('entity_table', array(
	"columns" => array(
		"Šifra" => array("value" => "Production.id", "function"=>'sprintf("%04d", {VAL})'),
		"Broj" => "Production.number",
		"Datum" => array("value"=>"Production.date", "function"=>'local_date("{VAL}", "short")'),
		"Prodavnica" => array("value"=>"Store", "function"=>'$this->Boni->store_name({VAL})'),
		"Proizvodi" => array("value" => "Product", "function"=>'$this->Production->productsList({VAL})'),
		"Cena" => array(
		    "value" => array(
		        "price" => "Product.{n}.ProductionProduct.price",
		        "amount" => "Product.{n}.ProductionProduct.amount",
		    ),
		    "function" => 'currency_format(products_price_sum({VAL}))'
		),
	    "Porez" => array("value"=>"Tax.0.value", "function"=>"floatval({VAL}) . '%'"),
	    "Iznos" => array(
	        "value" => array(
	            "price" => "Product.{n}.ProductionProduct.price",
	            "amount" => "Product.{n}.ProductionProduct.amount",
	            "rabat" => "Product.{n}.ProductionProduct.rabat",
	            "tax" => "Tax.0.value"
	        ),
	        "function"=>"currency_format(products_price_sum({VAL}))"
	    )
	),
	"column_width" => array(
		"Šifra" => "1%",
		"Datum" => "10%",
        "Proizvodi" => "35%"
	),
	"rows" => $data,
	"row_id" => "Production.id",
    "first_column_action" => "javascript:popUp('/proizvodnja/pregled/%s', 800, 800)",
	"delete_confirm" => "Da li želite da obrišete otpremu?"
)) ?>
<?= $this->element('pagination') ?>